import request from '@/utils/request'

export const fetchFoods = params => {
  return request({
    url: '/foods',
    params
  })
}
export const fetchFoodTypes = params => {
  return request({
    url: '/food-types',
    params
  })
}
export const addFoodType = data => {
  return request({
    url: '/food-types',
    method: 'post',
    data
  })
}
export const editFoodType = (data, id) => {
  return request({
    url: `/food-types/${id}`,
    method: 'put',
    data
  })
}
export const addFood = data => {
  return request({
    url: '/foods',
    method: 'post',
    data
  })
}
export const editFood = (data, id) => {
  return request({
    url: `/foods/${id}`,
    method: 'put',
    data
  })
}
export const delFood = id => {
  return request({
    url: `/foods/${id}`,
    method: 'delete'
  })
}
